//Thursday, December 17 2009
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class EasySequence
{
public:
	int find(vector <int> A, vector <int> B)
	{
		N = A.size();
		for(int i=N; i<1000000; i++)
		{
			int sum = 0;
			for(int j=i-1; j>=i-N; j--)
				sum += A[j];
			A.push_back(sum%10);
			cout << A[i] << ", ";
		}
		cout << endl;
		for(int i=0; i<A.size(); i++)
		{
			bool flag = true;
			for(int j=0; j<B.size(); j++)
				if(A[i+j] != B[j])
				{
					flag = false;
					break;
				}
			if(flag == true)
				return i;
		}
		return -1;
	}
	int N;
};
